package com.xbj.cloud.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/** 
 * @Author 木火
 * @Date  2024/8/3
 * @Param 
 * @Description Swagger3配置类
 **/
@Configuration
public class Swagger3Config
{
    @Bean
    public GroupedOpenApi OrderApi()
    {
        return GroupedOpenApi.builder().group("订单微服务模块").pathsToMatch("/feignOrder80/**").build();
    }
    @Bean
    public GroupedOpenApi OrderCircuit()
    {
        return GroupedOpenApi.builder().group("熔断测试模块").pathsToMatch("/orderCircuit/**").build();
    }
    @Bean
    public GroupedOpenApi OrderRatelimit()
    {
        return GroupedOpenApi.builder().group("限流测试模块").pathsToMatch("/orderRatelimit/**").build();
    }
    @Bean
    public GroupedOpenApi OrderBulkhead()
    {
        return GroupedOpenApi.builder().group("舱壁测试模块").pathsToMatch("/orderBulkhead/**").build();
    }
    @Bean
    public GroupedOpenApi OrderMicrometer()
    {
        return GroupedOpenApi.builder().group("服务链路追踪测试模块").pathsToMatch("/orderMicrometer/**").build();
    }
    @Bean
    public GroupedOpenApi OtherApi()
    {
        return GroupedOpenApi.builder().group("其它微服务模块").pathsToMatch("/other/**", "/others").build();
    }
    /*@Bean
    public GroupedOpenApi CustomerApi()
    {
        return GroupedOpenApi.builder().group("客户微服务模块").pathsToMatch("/customer/**", "/customers").build();
    }*/

    @Bean
    public OpenAPI docsOpenApi()
    {
        return new OpenAPI()
                .info(new Info().title("cloud2024")
                        .description("通用设计rest")
                        .version("v1.0"))
                .externalDocs(new ExternalDocumentation()
                        .description("www.atguigu.com")
                        .url("https://yiyan.baidu.com/"));
    }
}

